<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>梯形标签页</title>
    <link rel="stylesheet" href="../public.css">
    <style>
        .box {
            width: 200px;
            height: 20px;
            margin: 20px auto;
        }
        .box1 {
            width: 200px;
            height: 20px;
            margin: 20px auto;
            background: yellowgreen;
        }
        .trapezoid {
            background-color: green;
            transform: perspective(.5em) rotateX(5deg);
        }

        .trapezoid1 {
            position: relative;
            display: inline-block;
            padding: .5em 1em .35em;
            color: white;
        }

        .trapezoid1::before {
            content: '';
            position: absolute;
            top: 0;
            bottom: 0;
            right: 0;
            left: 0;
            z-index: -1;
            background: #58a;
            transform: perspective(.5em) rotateX(5deg);
        }

        .trapezoid2 {
            position: relative;
            display: inline-block;
            padding: .5em 1em .35em;
            color: white;
        }

        .trapezoid2::before {
            content: '';
            position: absolute;
            top: 0;
            bottom: 0;
            right: 0;
            left: 0;
            z-index: -1;
            background: #58a;
            transform:scale(1.3) perspective(.5em) rotateX(5deg);
            transform-origin: bottom;
        }
        .nav,.nav1{
         
        }
        .nav1{
            width: 280px;
            height: 100px;
            background: rgb(148, 146, 146);
        }
        .nav >a{
            position: relative;
            display: inline-block;
            padding:.3em 1em 0;
        }
        .nav>a::before{
            content: "";
            position: absolute;
            top: 0;
            bottom: 0;
            left: 0;
            right: 0;
            z-index: -1;
            background: #ccc;
            background-image: linear-gradient(hsla(0,0%,100%,.6),hsla(0,0%,100%,0));
            border: 1px solid rgba(0, 0, 0, .4);
            border-bottom: none;
            border-radius: .5em .5em 0 0;
            box-shadow: 0 .15em white inset;
            transform: perspective(.5em) rotateX(5deg);
            transform-origin: bottom;
        }
    </style>
</head>

<body>
    <div class="content">
        <h1>梯形标签页</h1>
        <ul>
            <li>可以利用css中3D旋转来模拟这个效果</li>
            <li>对元素使用3D变形之后，其内部变形效应是不可逆转的，最好的办法是把变形效果作用在伪元素上</li>
        </ul>
        <div class="box trapezoid ">
        </div>
        <div class="box  ">
            <div class="trapezoid1">
                平行四边形
            </div>
        </div>
        <div class="box1  ">
                平行四边形
        </div>
        <ul>
            <li>transform-origin: bottom;把底边固定住,这样可以把宽度固定住</li>
            <li>通过变形属性改变它的尺寸</li>
        </ul>
        <div class="box  ">
            <div class="trapezoid2">
                平行四边形
            </div>
        </div>
        <ul>
            <li>通过把transform-origin改成bottom、right、left,就可以获得左倾斜或右倾斜的标签页</li>
        </ul>
        <div class="nav">
            <a href="#">Home</a>
            <a href="#">Projects</a>
            <a href="#">About</a>
        </div>
        <div class="nav1">

        </div>
    </div>
</body>

</html>